2.4. Executing Your Migration Package
You're now ready to test
your SSIS package. In Visual Studio, click the green arrow on the
toolbar to begin package execution. Execution starts at the Clear Data
task—which, as you recall, deletes all the data from the UserDocs,
Users, and Docs tables. Execution next goes to the first data flow,
which queries data from the local Docs table (source) and copies it to
the TechBio database in the Docs table in SQL Azure (destination).
Execution then goes the second and third data flow tasks.
When execution is complete, all the tasks are green, as shown in Figure 15,
letting you know that they executed successfully. Any tasks that are
yellow are currently executing. Red tasks are bad: that means an error
occurred during the execution of the task, regardless of whether the
task was in the control flow or data flow, and execution stops.
If your tasks are all green,
you can go back to your root beer. Otherwise, the best place to start
debugging is the Output window. All output, including errors, is written
to this window. You can find errors easily by looking for any line that
starts with Error: toward the end of the list.
Errors you receive may be SSIS
specific or SQL Azure specific. For example, did you define your
connections correctly? Microsoft makes testing connections very simple,
and this doesn't mean the Test Connection button. The Source Editors
dialog—regardless if whether it's an OLE DB or ADO.NET Editor—includes a
Preview button that provides a small preview of your data, up to 200
rows. This ensures that at least your source connection works correctly.
2.5. Verifying the Migration
When you have everything
working and executing smoothly, in Visual Studio click the blue square
button on the toolbar to stop execution. Go back to SSMS, and query the
three tables in your SQL Azure instance to verify that data indeed
copied successfully. As shown in Figure 5-16, you should see roughly 100 rows in the Users table, two rows in the Docs table, and two rows in the UserDocs table.
2.6. Other Cases to Consider
This example was simple; the
source and destination tables were mirrors of each other, including
column names and data types. This made data migration easy. However, in
some cases the source and destination tables differ in column names and
data types. There are tasks that help with this, such as the Derived
Column, Data Conversion, and Lookup tasks. If you're using these tasks
and are getting errors, start by looking at these tasks to make sure
they aren't the source of data-truncation or data-conversion errors.
Again, this section isn't
intended to be an SSIS primer. Great books about SSIS are available that
focus on beginner topics all the way to advanced topics. Brian Knight
is a SQL Server MVP who has written numerous books on SSIS; his books
are highly recommended if you're looking for SSIS information and
instruction.So far we have talked about SSIS and the SQL Server Generate
and Publish Scripts wizard which both offer viable options for
migrating your data, but with little differences. For example, SSIS
doesn't migrate schema while the Scripts wizard does. Let's talk about
the third tool, Bcp, which also provides a method for migrating data to
SQL Azure.